package com.sylar.happygps;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class RoadAttrEditActivity extends Activity implements OnClickListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.roadattredit);

		Button btn_title_left = (Button) findViewById(R.id.btn_title_left);
		btn_title_left.setVisibility(View.VISIBLE);
		btn_title_left.setText(R.string.app_name);
		btn_title_left.setOnClickListener(this);

		Button btn_help = (Button) findViewById(R.id.btn_help);
		btn_help.setVisibility(View.VISIBLE);
		btn_help.setOnClickListener(this);

		TextView tv_title_name = (TextView) findViewById(R.id.tv_title_name);
		tv_title_name.setVisibility(View.VISIBLE);
		tv_title_name.setText("编辑导航道路属性提示");
		
		
		View layout_road_opt = findViewById(R.id.layout_road_opt);
		layout_road_opt.setOnClickListener(this);
		View layout_road_fast_opt = findViewById(R.id.layout_road_fast_opt);
		layout_road_fast_opt.setOnClickListener(this);
		View layout_road_wuca_opt = findViewById(R.id.layout_road_wuca_opt);
		layout_road_wuca_opt.setOnClickListener(this);
		View layout_road_run_opt = findViewById(R.id.layout_road_run_opt);
		layout_road_run_opt.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_title_left:
			finish();
			break;
		case R.id.btn_help:

			break;
		case R.id.layout_road_opt:
			showRoadType();
			break;
		case R.id.layout_road_fast_opt:
			showRoadFast();
			break;
		case R.id.layout_road_wuca_opt:
			showRoadWuca();
			break;
		case R.id.layout_road_run_opt:
			Intent intent = new Intent(this,RoadBendEditActivity.class);
			startActivity(intent);
			break;
		default:
			break;
		}
	}
	
	private void showRoadType(){
		new AlertDialog.Builder(this)
		.setItems(new String[]{"高速路","都市快速路","国道","省道","县乡道","城市主要道路","辅助道路","城市次要道路","城市一般道路","小区道路","景点道路","高速或快速路的连接线(入口)","高速或快速路的连接线(出口)","其它道路"},
			new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		})
		.setTitle("选择道路类型")
		.create().show();
	}
	
	
	private void showRoadFast(){
		new AlertDialog.Builder(this)
		.setItems(new String[]{"140公里/时","130公里/时","120公里/时","110公里/时","100公里/时","90公里/时","80公里/时","70公里/时","60公里/时","50公里/时","40公里/时","30公里/时"},
			new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		})
		.setTitle("选择道路类型")
		.create().show();
	}
	
	private void showRoadWuca(){
		new AlertDialog.Builder(this)
		.setItems(new String[]{"10米","15米","20米","25米","30米","40米","50米","60米","70米","80米","90米","100米","110米","120米","150米","200米","250米","300米","400米","500米","600米","700米","800米","1000米"},
			new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		})
		.setTitle("选择道路类型")
		.create().show();
	}
}
